package yqt.com.cnki.dao.impl;

import cnki.tpi.kbatis.sqlsession.SqlSession;
import cnki.tpi.kbatis.utils.DataSourceUtil;
import jzqb.bo.CollectDataBo;
import org.springframework.stereotype.Repository;
import yqt.com.cnki.bo.CollectionBo;
import yqt.com.cnki.bo.DownBo;
import yqt.com.cnki.bo.ViewBo;
import yqt.com.cnki.dao.PersonCenterDao;

import java.util.List;

@Repository
public class PersonCenterDaoImpl implements PersonCenterDao {

    @Override
    public List<CollectionBo> getCollectionList(CollectionBo collectionBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.PersonCenterDao.getCollectionList";
        return sqlSession.selectList(statementId, collectionBo, false);
    }

    @Override
    public Long getCollectionCount(CollectionBo collectionBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.PersonCenterDao.getCollectionCount";
        return sqlSession.getCount(statementId, collectionBo);
    }

    @Override
    public Boolean insertCollection(CollectionBo collectionBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.PersonCenterDao.insertCollection";
        return sqlSession.executeInsert(statementId, collectionBo);
    }

    @Override
    public Boolean deleteCollection(CollectionBo collectionBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.PersonCenterDao.deleteCollection";
        return sqlSession.executeDelete(statementId, collectionBo);
    }

    @Override
    public List<DownBo> getDownList(DownBo downBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.PersonCenterDao.getDownList";
        return sqlSession.selectList(statementId, downBo, false);
    }

    @Override
    public Long getDownListCount(DownBo downBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.PersonCenterDao.getDownListCount";
        return sqlSession.getCount(statementId, downBo);
    }

    @Override
    public Boolean insertDown(DownBo downBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.PersonCenterDao.insertDown";
        return sqlSession.executeInsert(statementId, downBo);
    }

    @Override
    public Boolean deleteDown(DownBo downBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.PersonCenterDao.deleteDown";
        return sqlSession.executeDelete(statementId, downBo);
    }

    @Override
    public List<ViewBo> getViewList(ViewBo viewBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.PersonCenterDao.getViewList";
        return sqlSession.selectList(statementId, viewBo, false);
    }

    @Override
    public Long getViewListCount(ViewBo viewBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.PersonCenterDao.getViewListCount";
        return sqlSession.getCount(statementId, viewBo);
    }

    @Override
    public Boolean insertView(ViewBo viewBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.PersonCenterDao.insertView";
        return sqlSession.executeInsert(statementId, viewBo);
    }

    @Override
    public Boolean deleteView(ViewBo viewBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.PersonCenterDao.deleteView";
        return sqlSession.executeDelete(statementId, viewBo);
    }

    @Override
    public Boolean deleteCollectionbyId(CollectionBo collectionBo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "yqt.com.cnki.dao.PersonCenterDao.deleteCollectionbyId";
        return sqlSession.executeDelete(statementId, collectionBo);
    }

}
